﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Run
{
    class Program
    {
        static void Main(string[] args)
        {
            const int l = 3000;
            var count = 0;
            var primi = new int[l/2];
            primi[0] = 2;
            for (var i = 2; i < l/2; i++)
            {
                var flag = false;
                for (var j = 0; j <= count; j++)
                {
                    flag |= i%primi[j] == 0;
                }
                if (flag) continue; //se non è primo
                count++;
                primi[count] = i;
                // Console.WriteLine(i);
            }
            var e = File.ReadAllText(@"e.txt");
            using (StreamWriter sw = new StreamWriter("TestFile34.txt"))
            {
                // Add some text to the file.
                sw.Write("This is the ");
                var temp = 0;
                var prec = 0;
                for (int i = 0; i < l; i++)
                {
                    temp += e[i] - 48;
                    for (var j = 0; j < (l/2); j++)
                    {
                        if (primi[j] == temp)
                        {
                            Console.WriteLine(primi[j]);
                            sw.Write(primi[j] + "-");
                        }
                    }

                }
                Console.ReadLine();
            }
        }
    }
   
}
